package com.kly.order.db.dao.impl;
import com.fqgj.common.base.AbstractBaseMapper;
import com.fqgj.common.utils.CollectionUtils;
import com.google.common.collect.Maps;
import com.kly.order.db.dao.BenefitsDao;
import com.kly.order.db.entity.BenefitsEntity;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;

/**
* User: 11437
* Date: 2023-06-01
* Time: 13:39:27.939
*/

@Repository
public class BenefitsDaoImpl extends AbstractBaseMapper<BenefitsEntity> implements BenefitsDao {
    @Override
    public BenefitsEntity getBenefits(Integer benefitCode) {
        final HashMap<String, Object> params = Maps.newHashMap();
        params.put("benefitCode", benefitCode);
        params.put("deleted", 0);
        final List<BenefitsEntity> benefitsEntities = this.selectByParams(params);
        if (CollectionUtils.isEmpty(benefitsEntities)) {
            return null;
        }
        return benefitsEntities.get(0);
    }
}